<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="renderer" content="webkit">
    <title>社区列表</title>
    <link rel="stylesheet" href="__ROOT__/static/admin/css/pintuer.css">
    <link rel="stylesheet" href="__ROOT__/static/admin/css/admin.css">
    <script src="__ROOT__/static/admin/js/jquery.js"></script>
    <script src="__ROOT__/static/admin/js/pintuer.js"></script>
    <script src="__ROOT__/static/plugins/layer/layer.min.js"></script>
</head>
<body>
<div class="panel admin-panel">
    <div class="panel-head"><strong class="icon-reorder"> 社区内容</strong></div>
    <div class="padding border-bottom">
        <a class="button border-yellow" href="{:url('admin/Community/createCommunityView')}"><span class="icon-plus-square-o"></span> 添加社区</a>
    </div>
    <table class="table table-hover text-center">
        <tr>
            <th width="5%">ID</th>
            <th>社区名称</th>
            <th>社区图片</th>
            <th>添加时间</th>
            <th width="250">操作</th>
        </tr>

        {volist name="res" id="vo" key='i'}
        <tr>
            <td>{$i}</td>
            <td>{$vo.community_name}</td>
            <td width="10%"><img src="__ROOT__{$vo.community_url}" alt="" width="70" height="50" /></td>
            <td>{:date('Y-m-d H:i:s',$vo.create_time)}</td>
            <td class="button-group">
                <a type="button" class="button border-main" href="{:url('admin/Community/updateCommunityView',array('id'=>$vo['id']))}"><span class="icon-edit"></span>修改</a>
                <a class="button border-red" href="javascript:;" onclick="del({$vo.id})"><span class="icon-trash-o"></span> 删除</a>
            </td>
        </tr>
        {/volist}
    </table>
</div>
<script type="text/javascript">

    function del(id){
        var community = {};
        community.id = id;
        layer.confirm('您确定要删除吗?', {
            btn: ['确定','取消']
        },  function(){
            $.post("{:url('admin/Community/delCommunity')}", community, function (response){
                if(response > 0){
                    layer.msg('删除成功', {icon: 5});
                    window.location.href = "{:url('admin/Community/index')}";
                }else {
                    layer.msg('删除失败', {icon: 5});
                }

            });
        });

    }
</script>
</body>
</html>